﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/MasterPages/Site.Master" Inherits="RushTracker.Web.UI.RushTrackerViewPage<IList<Role>>" %>

<asp:Content runat="server" ContentPlaceHolderID="head">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#createrolelink").click(function () {
                $.get($(this).attr("href"), function (data) {
                    var t = $(data).find("#title-createrole");
                    $(data).dialog({ width: 400, height: 178, modal: true, title: t.html(), resizable: false });
                });

                return false;
            });

            $(".editrolelink").click(function () {
                $.get($(this).attr("href"), function (data) {
                    var t = $(data).find("#title-editrole");
                    $(data).dialog({ width: 400, height: 178, modal: true, title: t.html(), resizable: false });
                });

                return false;
            });
        });
    </script>
</asp:Content>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="mainContent">
    <div class="box">
        <h2>Roles</h2>
        
        <div class="boxcontent">
            <table class="fullwidth">
                <tr>
                    <td class="highlight">Name</td>
                    <td class="highlight">Icon Url</td>
                    <td class="highlight">Actions</td>
                </tr>
                
                <% foreach (Role r in Model)
                   { %>
                
                <tr id="role_<%= r.Id %>">
                    <td><%= r.Name %></td>
                    <td><%= r.IconUrl %></td>
                    <td><%= Html.ActionLink("Edit", "EditRole", "Admin", new { roleId = r.Id }, new { @class = "editrolelink " })%></td>
                </tr>
                
                <%} %>
            </table>
        </div>
        
        <div class="boxfooter">
            <%= Html.ActionLink("Create role", "CreateRole", "Admin", null, new { id = "createrolelink" }) %>
        </div>
    </div>
</asp:Content>